package be.kdg.netpresentadmin;

import java.io.*;

/**
* Class that provides functionality to apply a "picture-filter" to
* a list of mixed file formats. 
*
* @autor Timothy Huber, Joris Clevenbergs, Rik verschuren, Wim Van der Wilt
*/
public class PictureFilter implements FilenameFilter {

	@Override
	/**
	 * Method for finding/extracting all picture file formats
	 * from the directory the user points to.
	 */
	public boolean accept(File dir, String name) {
		boolean noCapitals = (name.endsWith(".bmp") || name.endsWith(".gif")
				|| name.endsWith(".jpg") || name.endsWith(".jpeg")
				|| name.endsWith(".jpe") || name.endsWith(".jfif")
				|| name.endsWith(".png") || name.endsWith(".tif") || name
				.endsWith(".tiff"));
		
		boolean capitals = (name.endsWith(".BMP") || name.endsWith(".GIF")
				|| name.endsWith(".JPG") || name.endsWith(".JPEG")
				|| name.endsWith(".JPE") || name.endsWith(".JFIF")
				|| name.endsWith(".PNG") || name.endsWith(".TIF") || name
				.endsWith(".TIFF"));

		return (noCapitals || capitals);
	}
}
